<?php
function add($a,$b){
  return $a + $b ;
}
function get($name){
  return isset($_GET[$name])? $_GET[$name]:'';
}
function post($name){
  return isset($_POST[$name])? $_POST[$name]:'';
}

$a = post('a');
$b = post('b');
$result = add($a, $b);
 ?>
<form action="" method="post">
  <input type="text" value="<?php echo $a; ?>" name="a"/>+
  <input type="text" value="<?php echo $b; ?>" name="b"/>=<?php echo $result;
  ?><br/>
  <input type="submit"/>
</form>
